Introduction and the function/configuration of the I2C master/slave communication.
More...
Overview
The I2C communication application demonstrates I2C data communication with sub address function and low power wakeup by I2C slave address matching.
At first I2C slave enters low power wait mode, and one LED on I2C slave board is on to indicate the MCU is in sleep and no code is running.
Then I2C slave is waken up by I2C address matching interrupt when I2C master sends address, and the LED on I2C slave board is toggled during data communication.
After power on, I2C master starts to read data from I2C slave data buffer, and print out on the screen showing below:
I2C Master reads buffer values from I2C Slave sub address:
| Slave Sub Address | Character |
| [0] | I |
| [1] | 2 |
| [2] | C |
| [3] | - |
| [4] | C |
| [5] | O |
| [6] | M |
| [7] | M |
User can change I2C slave sub address content by inputing new character in I2C master command line:
"
Please input Slave sub address and the new character.
Slave Sub Address: 5
Input New Character: 5
"
Then the slave sub address and the new character are transmitted to I2C slave by I2C sub address field and data field.
Received the data, I2C slave changes its sub address content according to the sub address and data received.
Supported platforms
Currently, the i2c_comm project is supported on the following platforms:
- TWR-K64F120M
- FRDM-K64F120M
Serial terminal configuration
The I2C master and slave's serial terminal is configured for the following settings:
- 115200
- 8 data bits
- No parity
- 1 stop bit